<template>
  <el-col style="margin: 10px auto;max-width: calc(100vw - 210px);">
    <div style="margin-top: 50px;"></div>
    <div style="min-height: 20%">
      <el-card style="border-radius: 20px">
        <el-button type="primary" style="width: 85px;margin-left: 10px" @click="load">搜索</el-button>
        <el-button type="default" style="width: 85px">新增职位</el-button>
        <el-input v-model="keyWords" placeholder="请输入关键词" style="width: 300px;margin-left: 20px "
                  clearable></el-input>
      </el-card>
      <el-card style="border-radius: 20px;margin-top: 10px">
        <el-table
            :data="CustomerList"
            style="border-radius: 15px"
            height="460"
        >
          <el-table-column prop="customername" label="企业名称"/>
          <el-table-column prop="type" label="行业" sortable=""/>
          <el-table-column prop="scope" label="规模" sortable=""/>
          <el-table-column prop="position" label="在招职位" sortable=""/>
          <el-table-column prop="lastinfo" label="沟通方式"/>
        </el-table>
      </el-card>
    </div>
    <div style="margin: 10px 0">
      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[5,10,15,20]"
          :page-size="pageSize"
          layout="total,sizes,prev,pager,next,jumper"
          :total="total">
      </el-pagination>
    </div>
  </el-col>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "Customer",
  components: {},
  data() {
    return{
      form:{},
      CustomerList:[],
      currentPage:1,
      pageSize:10,
      total:0,
      keyWords:"",
    }
  },
  created() {
    this.load()
  },
  methods: {
    load(){
      request.get("/customer/find",{
        params:{
          pageNumber:this.currentPage,
          pageSize:this.pageSize,
          keyWords:this.keyWords
        }
      }).then(res=>{
        console.log(res)
        this.CustomerList=res.data.records
        this.total=res.data.total
      })
    },
    handleSizeChange(val){
      this.pageSize=val
      this.load()
    },
    handleCurrentChange(val){
      this.currentPage=val
      this.load()
    },
  },
}
</script>

<style scoped>

</style>